diff options
author | Larry Knox <lrknox@hdfgroup.org> | 2021-02-08 16:56:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 16:56:16 (GMT) |
commit | 22c67ff6570f16050f0a5654cf1c84df917bb598 (patch) | |
tree | 38fb63aa498b250c2543fe7e22a511706de96a42 /src/H5Oattribute.c | |
parent | 551f15f8ae02ca9c995619b216121081eb07633e (diff) | |
download | hdf5-hdf5-1_8_22.zip hdf5-hdf5-1_8_22.tar.gz hdf5-hdf5-1_8_22.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 'src/H5Oattribute.c')
-rw-r--r-- | src/H5Oattribute.c | 1025 |
1 files changed, 478 insertions, 547 deletions
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 972ad2a..fa78d9e 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -6,18 +6,16 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- * - * Created: H5Oattribute.c - * Dec 11 2006 - * Quincey Koziol <koziol@hdfgroup.org> + * Created: H5Oattribute.c * - * Purpose: Object header attribute routines. + * Purpose: Object header attribute routines. * *------------------------------------------------------------------------- */ @@ -26,132 +24,123 @@ /* Module Setup */ /****************/ -#define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5O_PACKAGE /*suppress error about including H5Opkg */ +#define H5A_PACKAGE /*suppress error about including H5Apkg */ +#define H5O_PACKAGE /*suppress error about including H5Opkg */ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Apkg.h" /* Attributes */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Fprivate.h" /* File */ - +#include "H5private.h" /* Generic Functions */ +#include "H5Apkg.h" /* Attributes */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5SMprivate.h" /* Shared Object Header Messages */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Fprivate.h" /* File */ /****************/ /* Local Macros */ /****************/ - /******************/ /* Local Typedefs */ /******************/ /* User data for iteration when converting attributes to dense storage */ typedef struct { - H5F_t *f; /* Pointer to file for insertion */ - hid_t dxpl_id; /* DXPL during iteration */ - H5O_ainfo_t *ainfo; /* Attribute info struct */ + H5F_t * f; /* Pointer to file for insertion */ + hid_t dxpl_id; /* DXPL during iteration */ + H5O_ainfo_t *ainfo; /* Attribute info struct */ } H5O_iter_cvt_t; /* User data for iteration when opening an attribute */ typedef struct { /* down */ - const char *name; /* Name of attribute to open */ + const char *name; /* Name of attribute to open */ /* up */ - H5A_t *attr; /* Attribute data to update object header with */ + H5A_t *attr; /* Attribute data to update object header with */ } H5O_iter_opn_t; /* User data for iteration when updating an attribute */ typedef struct { /* down */ - H5F_t *f; /* Pointer to file attribute is in */ - hid_t dxpl_id; /* DXPL for operation */ - H5A_t *attr; /* Attribute data to update object header with */ + H5F_t *f; /* Pointer to file attribute is in */ + hid_t dxpl_id; /* DXPL for operation */ + H5A_t *attr; /* Attribute data to update object header with */ /* up */ - hbool_t found; /* Whether the attribute was found */ + hbool_t found; /* Whether the attribute was found */ } H5O_iter_wrt_t; /* User data for iteration when renaming an attribute */ typedef struct { /* down */ - H5F_t *f; /* Pointer to file attribute is in */ - hid_t dxpl_id; /* DXPL for operation */ - const char *old_name; /* Old name of attribute */ - const char *new_name; /* New name of attribute */ + H5F_t * f; /* Pointer to file attribute is in */ + hid_t dxpl_id; /* DXPL for operation */ + const char *old_name; /* Old name of attribute */ + const char *new_name; /* New name of attribute */ /* up */ - hbool_t found; /* Whether the attribute was found */ + hbool_t found; /* Whether the attribute was found */ } H5O_iter_ren_t; /* User data for iteration when iterating over attributes */ typedef struct { /* down */ - H5F_t *f; /* Pointer to file attribute is in */ - hid_t dxpl_id; /* DXPL for operation */ - hid_t loc_id; /* ID of object being iterated over */ - unsigned skip; /* # of attributes to skip over */ - H5A_operator_t op; /* Callback routine for each attribute */ - void *op_data; /* User data for callback */ + H5F_t * f; /* Pointer to file attribute is in */ + hid_t dxpl_id; /* DXPL for operation */ + hid_t loc_id; /* ID of object being iterated over */ + unsigned skip; /* # of attributes to skip over */ + H5A_operator_t op; /* Callback routine for each attribute */ + void * op_data; /* User data for callback */ /* up */ - unsigned count; /* Count of attributes examined */ + unsigned count; /* Count of attributes examined */ } H5O_iter_itr_t; /* User data for iteration when removing an attribute */ typedef struct { /* down */ - H5F_t *f; /* Pointer to file attribute is in */ - hid_t dxpl_id; /* DXPL for operation */ - const char *name; /* Name of attribute to open */ + H5F_t * f; /* Pointer to file attribute is in */ + hid_t dxpl_id; /* DXPL for operation */ + const char *name; /* Name of attribute to open */ /* up */ - hbool_t found; /* Found attribute to delete */ + hbool_t found; /* Found attribute to delete */ } H5O_iter_rm_t; /* User data for iteration when checking if an attribute exists */ typedef struct { /* down */ - const char *name; /* Name of attribute to open */ + const char *name; /* Name of attribute to open */ /* up */ - hbool_t found; /* Found attribute */ + hbool_t found; /* Found attribute */ } H5O_iter_xst_t; - /********************/ /* Package Typedefs */ /********************/ - /********************/ /* Local Prototypes */ /********************/ -static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, - const char* name_to_open); +static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_to_open); /*********************/ /* Package Variables */ /*********************/ - /*****************************/ /* Library Private Variables */ /*****************************/ - /*******************/ /* Local Variables */ /*******************/ - - /*------------------------------------------------------------------------- * Function: H5O_attr_to_dense_cb * @@ -161,22 +150,17 @@ static htri_t H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t -H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) +H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUSED sequence, + unsigned *oh_modified, void *_udata /*in,out*/) { - H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */ - H5A_t *attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_cvt_t *udata = (H5O_iter_cvt_t *)_udata; /* Operator user data */ + H5A_t * attr = (H5A_t *)mesg->native; /* Pointer to attribute to insert */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -189,12 +173,12 @@ H5O_attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(attr); /* Insert attribute into dense storage */ - if(H5A_dense_insert(udata->f, udata->dxpl_id, udata->ainfo, attr) < 0) + if (H5A_dense_insert(udata->f, udata->dxpl_id, udata->ainfo, attr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") /* Convert message into a null message in the header */ /* (don't delete attribute's space in the file though) */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) + if (H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -204,7 +188,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_to_dense_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_create * @@ -220,10 +203,10 @@ done: herr_t H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -232,26 +215,26 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) HDassert(attr); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check if this object already has attribute information */ - if(oh->version > H5O_VERSION_1) { - hbool_t new_ainfo = FALSE; /* Flag to indicate that the attribute information is new */ - htri_t ainfo_exists; /* Whether the attribute info was retrieved */ + if (oh->version > H5O_VERSION_1) { + hbool_t new_ainfo = FALSE; /* Flag to indicate that the attribute information is new */ + htri_t ainfo_exists; /* Whether the attribute info was retrieved */ /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) + if ((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") - if(!ainfo_exists) { + if (!ainfo_exists) { /* Initialize attribute information */ - ainfo.track_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? TRUE : FALSE); - ainfo.index_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? TRUE : FALSE); - ainfo.max_crt_idx = 0; + ainfo.track_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? TRUE : FALSE); + ainfo.index_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? TRUE : FALSE); + ainfo.max_crt_idx = 0; ainfo.corder_bt2_addr = HADDR_UNDEF; - ainfo.nattrs = 0; - ainfo.fheap_addr = HADDR_UNDEF; - ainfo.name_bt2_addr = HADDR_UNDEF; + ainfo.nattrs = 0; + ainfo.fheap_addr = HADDR_UNDEF; + ainfo.name_bt2_addr = HADDR_UNDEF; /* Set flag to add attribute information to object header */ new_ainfo = TRUE; @@ -264,47 +247,48 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) } /* end else */ /* Check if switching to "dense" attribute storage is possible */ - if(!H5F_addr_defined(ainfo.fheap_addr)) { - htri_t sharable; /* Whether the attribute will be shared */ - size_t raw_size = 0; /* Raw size of message */ + if (!H5F_addr_defined(ainfo.fheap_addr)) { + htri_t sharable; /* Whether the attribute will be shared */ + size_t raw_size = 0; /* Raw size of message */ /* Check for attribute being sharable */ - if((sharable = H5SM_can_share(loc->file, dxpl_id, NULL, NULL, H5O_ATTR_ID, attr)) < 0) + if ((sharable = H5SM_can_share(loc->file, dxpl_id, NULL, NULL, H5O_ATTR_ID, attr)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't determine attribute sharing status") - else if(sharable == FALSE) { + else if (sharable == FALSE) { /* Compute the size needed to encode the attribute */ raw_size = (H5O_MSG_ATTR->raw_size)(loc->file, FALSE, attr); } /* end if */ /* Check for condititions for switching to "dense" attribute storage are met */ - if(ainfo.nattrs == oh->max_compact || (!sharable && raw_size >= H5O_MESG_MAX_SIZE)) { - H5O_iter_cvt_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + if (ainfo.nattrs == oh->max_compact || (!sharable && raw_size >= H5O_MESG_MAX_SIZE)) { + H5O_iter_cvt_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Create dense storage for attributes */ - if(H5A_dense_create(loc->file, dxpl_id, &ainfo) < 0) + if (H5A_dense_create(loc->file, dxpl_id, &ainfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create dense storage for attributes") /* Set up user data for callback */ - udata.f = loc->file; + udata.f = loc->file; udata.dxpl_id = dxpl_id; - udata.ainfo = &ainfo; + udata.ainfo = &ainfo; /* Iterate over existing attributes, moving them to dense storage */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_to_dense_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage") + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, + "error converting attributes to dense storage") } /* end if */ - } /* end if */ + } /* end if */ /* Increment attribute count on object */ ainfo.nattrs++; /* Check whether we're tracking the creation index on attributes */ - if(ainfo.track_corder) { + if (ainfo.track_corder) { /* Check for attribute creation order index on the object wrapping around */ - if(ainfo.max_crt_idx == H5O_MAX_CRT_ORDER_IDX) + if (ainfo.max_crt_idx == H5O_MAX_CRT_ORDER_IDX) HGOTO_ERROR(H5E_ATTR, H5E_CANTINC, FAIL, "attribute creation index can't be incremented") /* Set the creation order index on the attribute & incr. creation order index */ @@ -315,16 +299,18 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) attr->shared->crt_idx = H5O_MAX_CRT_ORDER_IDX; /* Add the attribute information message, if one is needed */ - if(new_ainfo) { - if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < 0) + if (new_ainfo) { + if (H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, + &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new attribute info message") } /* end if */ /* Otherwise, update existing message */ else { - if(H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < 0) + if (H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < + 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") } /* end else */ - } /* end if */ + } /* end if */ else { /* Set "bogus" creation index for attribute */ attr->shared->crt_idx = H5O_MAX_CRT_ORDER_IDX; @@ -334,14 +320,14 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) } /* end else */ /* Check for storing attribute with dense storage */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Insert attribute into dense storage */ - if(H5A_dense_insert(loc->file, dxpl_id, &ainfo, attr) < 0) + if (H5A_dense_insert(loc->file, dxpl_id, &ainfo, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to add to dense storage") } /* end if */ else { /* Append new message to object header */ - if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, attr) < 0) + if (H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new attribute in header") } /* end else */ @@ -352,11 +338,11 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) attr->shared->nrefs += 1; /* Was new attribute shared? */ - if((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr)) > 0) { - hsize_t attr_rc; /* Attribute's ref count in shared message storage */ + if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr)) > 0) { + hsize_t attr_rc; /* Attribute's ref count in shared message storage */ /* Retrieve ref count for shared attribute */ - if(H5SM_get_refcount(loc->file, dxpl_id, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0) + if (H5SM_get_refcount(loc->file, dxpl_id, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") /* If this is not the first copy of the attribute in the shared message @@ -382,26 +368,25 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) * * *ick* -QAK, 2007/01/08 */ - if(attr_rc > 1) { - if(H5O_attr_delete(loc->file, dxpl_id, oh, attr) < 0) + if (attr_rc > 1) { + if (H5O_attr_delete(loc->file, dxpl_id, oh, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") } /* end if */ - } /* end if */ - else if(shared_mesg < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") + } /* end if */ + else if (shared_mesg < 0) + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") /* Update the modification time, if any */ - if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) + if (H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_create() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_open_cb * @@ -411,21 +396,16 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change oh_modified from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t -H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, - unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) +H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, + unsigned H5_ATTR_UNUSED *oh_modified, void *_udata /*in,out*/) { - H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_opn_t *udata = (H5O_iter_opn_t *)_udata; /* Operator user data */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -435,15 +415,14 @@ H5O_attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, HDassert(!udata->attr); /* Check for correct attribute message to modify */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { + if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Make a copy of the attribute to return */ - if(NULL == (udata->attr = H5A_copy(NULL, (H5A_t *)mesg->native))) + if (NULL == (udata->attr = H5A_copy(NULL, (H5A_t *)mesg->native))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy attribute") /* Assign [somewhat arbitrary] creation order value, for older versions * of the format or if creation order is not tracked */ - if(oh->version == H5O_VERSION_1 - || !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) + if (oh->version == H5O_VERSION_1 || !(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) udata->attr->shared->crt_idx = sequence; /* Stop iterating */ @@ -454,7 +433,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_open_by_name * @@ -465,22 +443,17 @@ done: * Programmer: Quincey Koziol * Monday, December 11, 2006 * - * Modification:Raymond Lu - * 23 June 2008 - * If the attribute is in dense storage and has already been - * opened, make a copy of already opened object to share some - * object information. *------------------------------------------------------------------------- */ H5A_t * H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - H5A_t *exist_attr = NULL; /* Existing opened attribute object */ - H5A_t *opened_attr = NULL; /* Newly opened attribute object */ - htri_t found_open_attr = FALSE; /* Whether opened object is found */ - H5A_t *ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + H5A_t * exist_attr = NULL; /* Existing opened attribute object */ + H5A_t * opened_attr = NULL; /* Newly opened attribute object */ + htri_t found_open_attr = FALSE; /* Whether opened object is found */ + H5A_t * ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -489,49 +462,49 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HDassert(name); /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + if (H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't check for attribute info message") } /* end if */ /* If found the attribute is already opened, make a copy of it to share the * object information. If not, open attribute as a new object */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0) + if ((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") - else if(found_open_attr == TRUE) { - if(NULL == (opened_attr = H5A_copy(NULL, exist_attr))) + else if (found_open_attr == TRUE) { + if (NULL == (opened_attr = H5A_copy(NULL, exist_attr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") } /* end else if */ else { /* Check for attributes in dense storage */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Open attribute with dense storage */ - if(NULL == (opened_attr = H5A_dense_open(loc->file, dxpl_id, &ainfo, name))) + if (NULL == (opened_attr = H5A_dense_open(loc->file, dxpl_id, &ainfo, name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") } /* end if */ else { - H5O_iter_opn_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + H5O_iter_opn_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Set up user data for callback */ udata.name = name; udata.attr = NULL; /* Iterate over attributes, to locate correct one to open */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_open_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute") /* Check that we found the attribute */ - if(!udata.attr) + if (!udata.attr) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute: '%s'", name) /* Get attribute opened from object header */ @@ -540,7 +513,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) } /* end else */ /* Mark datatype as being on disk now */ - if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0) + if (H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") } /* end else */ @@ -548,18 +521,17 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) ret_value = opened_attr; done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") /* Release any resources, on error */ - if(NULL == ret_value && opened_attr) - if(H5A_close(opened_attr) < 0) + if (NULL == ret_value && opened_attr) + if (H5A_close(opened_attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_name() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_open_by_idx_cb * @@ -569,7 +541,6 @@ done: * Failure: Negative * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 18 2006 * *------------------------------------------------------------------------- @@ -577,8 +548,8 @@ done: static herr_t H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) { - H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */ - herr_t ret_value = H5_ITER_STOP; /* Return value */ + H5A_t **ret_attr = (H5A_t **)_ret_attr; /* 'User data' passed in */ + herr_t ret_value = H5_ITER_STOP; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -587,14 +558,13 @@ H5O_attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) HDassert(ret_attr); /* Copy attribute information. Shared some attribute information. */ - if(NULL == (*ret_attr = H5A_copy(NULL, attr))) + if (NULL == (*ret_attr = H5A_copy(NULL, attr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_idx_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_open_by_idx * @@ -606,23 +576,18 @@ done: * Programmer: Quincey Koziol * Monday, December 18, 2006 * - * Modification:Raymond Lu - * 23 June 2008 - * After opening the attribute, check whether it's in dense - * storage and has already been opened. If it has, close the - * opened object and make a copy of already opened object. *------------------------------------------------------------------------- */ H5A_t * -H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, hid_t dxpl_id) +H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + hid_t dxpl_id) { - H5O_t *oh = NULL; /* Object header */ - H5A_attr_iter_op_t attr_op; /* Attribute operator */ - H5A_t *exist_attr = NULL; /* Existing opened attribute object */ - H5A_t *opened_attr = NULL; /* Newly opened attribute object */ - htri_t found_open_attr = FALSE; /* Whether opened object is found */ - H5A_t *ret_value; /* Return value */ + H5O_t * oh = NULL; /* Object header */ + H5A_attr_iter_op_t attr_op; /* Attribute operator */ + H5A_t * exist_attr = NULL; /* Existing opened attribute object */ + H5A_t * opened_attr = NULL; /* Newly opened attribute object */ + htri_t found_open_attr = FALSE; /* Whether opened object is found */ + H5A_t * ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -630,55 +595,55 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, HDassert(loc); /* Build attribute operator info */ - attr_op.op_type = H5A_ATTR_OP_LIB; + attr_op.op_type = H5A_ATTR_OP_LIB; attr_op.u.lib_op = H5O_attr_open_by_idx_cb; /* Iterate over attributes to locate correct one */ - if(H5O_attr_iterate_real((hid_t)-1, loc, dxpl_id, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0) + if (H5O_attr_iterate_real((hid_t)-1, loc, dxpl_id, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, NULL, "can't locate attribute") /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Find out whether it has already been opened. If it has, close the object * and make a copy of the already opened object to share the object info. */ - if(opened_attr) { - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) + if (opened_attr) { + if ((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, opened_attr->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") /* If found that the attribute is already opened, make a copy of it * and close the object just opened. */ - if(found_open_attr && exist_attr) { - if(H5A_close(opened_attr) < 0) + if (found_open_attr && exist_attr) { + if (H5A_close(opened_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") - if(NULL == (opened_attr = H5A_copy(NULL, exist_attr))) + if (NULL == (opened_attr = H5A_copy(NULL, exist_attr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") - } else { + } + else { /* Mark datatype as being on disk now */ - if(H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0) + if (H5T_set_loc(opened_attr->shared->dt, loc->file, H5T_LOC_DISK) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") } /* end if */ - } /* end if */ + } /* end if */ /* Set return value */ ret_value = opened_attr; done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") /* Release any resources, on error */ - if(NULL == ret_value && opened_attr) - if(H5A_close(opened_attr) < 0) + if (NULL == ret_value && opened_attr) + if (H5A_close(opened_attr) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_find_opened_attr * @@ -695,71 +660,70 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char* name_to_open) +H5O_attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_to_open) { - hid_t *attr_id_list = NULL; /* List of IDs for opened attributes */ - unsigned long loc_fnum; /* File serial # for object */ - size_t num_open_attr; /* Number of opened attributes */ - htri_t ret_value = FALSE; /* Return value */ + hid_t * attr_id_list = NULL; /* List of IDs for opened attributes */ + unsigned long loc_fnum; /* File serial # for object */ + size_t num_open_attr; /* Number of opened attributes */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* Get file serial number for the location of attribute */ - if(H5F_get_fileno(loc->file, &loc_fnum) < 0) + if (H5F_get_fileno(loc->file, &loc_fnum) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number") /* Count all opened attributes */ - if(H5F_get_obj_count(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, FALSE, &num_open_attr) < 0) + if (H5F_get_obj_count(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, FALSE, &num_open_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't count opened attributes") /* Find out whether the attribute has been opened */ - if(num_open_attr) { - size_t check_num_attr; /* Number of open attribute IDs */ - size_t u; /* Local index variable */ + if (num_open_attr) { + size_t check_num_attr; /* Number of open attribute IDs */ + size_t u; /* Local index variable */ /* Allocate space for the attribute ID list */ - if(NULL == (attr_id_list = (hid_t *)H5MM_malloc(num_open_attr * sizeof(hid_t)))) + if (NULL == (attr_id_list = (hid_t *)H5MM_malloc(num_open_attr * sizeof(hid_t)))) HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "unable to allocate memory for attribute ID list") /* Retrieve the IDs of all opened attributes */ - if(H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, &check_num_attr) < 0) + if (H5F_get_obj_ids(loc->file, H5F_OBJ_ATTR | H5F_OBJ_LOCAL, num_open_attr, attr_id_list, FALSE, + &check_num_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes") - if(check_num_attr != num_open_attr) + if (check_num_attr != num_open_attr) HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "open attribute count mismatch") /* Iterate over the attributes */ - for(u = 0; u < num_open_attr; u++) { - unsigned long attr_fnum; /* Attributes file serial number */ + for (u = 0; u < num_open_attr; u++) { + unsigned long attr_fnum; /* Attributes file serial number */ /* Get pointer to attribute */ - if(NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR))) + if (NULL == (*attr = (H5A_t *)H5I_object_verify(attr_id_list[u], H5I_ATTR))) HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute") /* Get file serial number for attribute */ - if(H5F_get_fileno((*attr)->oloc.file, &attr_fnum) < 0) + if (H5F_get_fileno((*attr)->oloc.file, &attr_fnum) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number") /* Verify whether it's the right object. The attribute name, object * address to which the attribute is attached, and file serial * number should all match. */ - if(!HDstrcmp(name_to_open, (*attr)->shared->name) && - loc->addr == (*attr)->oloc.addr && - loc_fnum == attr_fnum) { + if (!HDstrcmp(name_to_open, (*attr)->shared->name) && loc->addr == (*attr)->oloc.addr && + loc_fnum == attr_fnum) { ret_value = TRUE; break; } /* end if */ - } /* end for */ - } /* end if */ + } /* end for */ + } /* end if */ done: - if(attr_id_list) + if (attr_id_list) H5MM_free(attr_id_list); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_find_opened_attr */ - /*------------------------------------------------------------------------- * Function: H5O_attr_update_shared * @@ -768,19 +732,17 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Jan 2 2007 * *------------------------------------------------------------------------- */ herr_t -H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr, - H5O_shared_t *update_sh_mesg) +H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr, H5O_shared_t *update_sh_mesg) { - H5O_shared_t sh_mesg; /* Shared object header message */ - hsize_t attr_rc; /* Attribute's ref count in shared message storage */ - htri_t shared_mesg; /* Whether the message should be shared */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_shared_t sh_mesg; /* Shared object header message */ + hsize_t attr_rc; /* Attribute's ref count in shared message storage */ + htri_t shared_mesg; /* Whether the message should be shared */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -789,22 +751,22 @@ H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr, HDassert(attr); /* Extract shared message info from current attribute (for later use) */ - if(H5O_set_shared(&sh_mesg, &(attr->sh_loc)) < 0) + if (H5O_set_shared(&sh_mesg, &(attr->sh_loc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't get shared message") /* Reset existing sharing information */ - if(H5O_msg_reset_share(H5O_ATTR_ID, attr) < 0) + if (H5O_msg_reset_share(H5O_ATTR_ID, attr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing") /* Store new version of message as a SOHM */ /* (should always work, since we're not changing the size of the attribute) */ - if((shared_mesg = H5SM_try_share(f, dxpl_id, oh, 0, H5O_ATTR_ID, attr, NULL)) == 0) + if ((shared_mesg = H5SM_try_share(f, dxpl_id, oh, 0, H5O_ATTR_ID, attr, NULL)) == 0) HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "attribute changed sharing status") - else if(shared_mesg < 0) + else if (shared_mesg < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't share attribute") /* Retrieve shared message storage ref count for new shared attribute */ - if(H5SM_get_refcount(f, dxpl_id, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0) + if (H5SM_get_refcount(f, dxpl_id, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") /* If the newly shared attribute needs to share "ownership" of the shared @@ -816,26 +778,25 @@ H5O_attr_update_shared(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5A_t *attr, * * *ick* -QAK, 2007/01/08 */ - if(attr_rc == 1) { + if (attr_rc == 1) { /* Increment reference count on attribute components */ - if(H5O_attr_link(f, dxpl_id, oh, attr) < 0) + if (H5O_attr_link(f, dxpl_id, oh, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") } /* end if */ /* Remove the old attribute from the SOHM storage */ - if(H5SM_delete(f, dxpl_id, oh, &sh_mesg) < 0) + if (H5SM_delete(f, dxpl_id, oh, &sh_mesg) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute in shared storage") /* Extract updated shared message info from modified attribute, if requested */ - if(update_sh_mesg) - if(H5O_set_shared(update_sh_mesg, &(attr->sh_loc)) < 0) + if (update_sh_mesg) + if (H5O_set_shared(update_sh_mesg, &(attr->sh_loc)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't get shared message") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_update_shared() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_write_cb * @@ -845,28 +806,22 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 4 2006 * * Modification:Raymond Lu * 4 June 2008 * Took out the data copying part because the attribute data * is shared between attribute handle and object header. - * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified but does not need to - * condense messages in the object header *------------------------------------------------------------------------- */ static herr_t -H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) +H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUSED sequence, + unsigned *oh_modified, void *_udata /*in,out*/) { - H5O_iter_wrt_t *udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */ - H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ - hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_wrt_t * udata = (H5O_iter_wrt_t *)_udata; /* Operator user data */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ + hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -876,15 +831,15 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Check for correct attribute message to modify */ - if(0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { + if (0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { /* Protect chunk */ - if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno))) + if (NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno))) HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk") /* Because the attribute structure is shared now. The only situation that requires - * copying the data is when the metadata cache evicts and reloads this attribute. + * copying the data is when the metadata cache evicts and reloads this attribute. * The shared attribute structure will be different in that situation. SLU-2010/7/29 */ - if(((H5A_t *)mesg->native)->shared != udata->attr->shared) { + if (((H5A_t *)mesg->native)->shared != udata->attr->shared) { /* Sanity check */ HDassert(((H5A_t *)mesg->native)->shared->data); HDassert(udata->attr->shared->data); @@ -892,7 +847,8 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* (Needs to occur before updating the shared message, or the hash * value on the old & new messages will be the same) */ - HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size); + HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, + udata->attr->shared->data_size); } /* end if */ /* Mark the message as modified */ @@ -900,14 +856,16 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, chk_dirtied = TRUE; /* Release chunk */ - if(H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) + if (H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") chk_proxy = NULL; /* Update the shared attribute in the SOHM storage */ - if(mesg->flags & H5O_MSG_FLAG_SHARED) - if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage") + if (mesg->flags & H5O_MSG_FLAG_SHARED) + if (H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, + (H5O_shared_t *)mesg->native) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, + "unable to update attribute in shared storage") /* Indicate that the object header was modified */ *oh_modified = H5O_MODIFY; @@ -921,13 +879,12 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: /* Release chunk, if not already done */ - if(chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) + if (chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_write_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_write * @@ -943,9 +900,9 @@ done: herr_t H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -954,56 +911,55 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) HDassert(attr); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + if (H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for attributes stored densely */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Modify the attribute data in dense storage */ - if(H5A_dense_write(loc->file, dxpl_id, &ainfo, attr) < 0) + if (H5A_dense_write(loc->file, dxpl_id, &ainfo, attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") } /* end if */ else { - H5O_iter_wrt_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + H5O_iter_wrt_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Set up user data for callback */ - udata.f = loc->file; + udata.f = loc->file; udata.dxpl_id = dxpl_id; - udata.attr = attr; - udata.found = FALSE; + udata.attr = attr; + udata.found = FALSE; /* Iterate over attributes, to locate correct one to update */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_write_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") /* Check that we found the attribute */ - if(!udata.found) + if (!udata.found) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate open attribute?") } /* end else */ /* Update the modification time, if any */ - if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) + if (H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_write */ - /*------------------------------------------------------------------------- * Function: H5O_attr_rename_chk_cb * @@ -1013,21 +969,17 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 5 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) +H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, + unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, + void *_udata /*in,out*/) { - H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1037,7 +989,7 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Check for existing attribute with new name */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) { + if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) { /* Indicate that we found an existing attribute with the new name*/ udata->found = TRUE; @@ -1048,7 +1000,6 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_rename_chk_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_rename_mod_cb * @@ -1063,23 +1014,18 @@ H5O_attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 5 2006 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t -H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) +H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUSED sequence, + unsigned *oh_modified, void *_udata /*in,out*/) { - H5O_iter_ren_t *udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ - H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ - hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_ren_t * udata = (H5O_iter_ren_t *)_udata; /* Operator user data */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk that message is in */ + hbool_t chk_dirtied = FALSE; /* Flag for unprotecting chunk */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1089,11 +1035,11 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Find correct attribute message to rename */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) { - unsigned old_version = ((H5A_t *)mesg->native)->shared->version; /* Old version of the attribute */ + if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) { + unsigned old_version = ((H5A_t *)mesg->native)->shared->version; /* Old version of the attribute */ /* Protect chunk */ - if(NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno))) + if (NULL == (chk_proxy = H5O_chunk_protect(udata->f, udata->dxpl_id, oh, mesg->chunkno))) HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk") /* Change the name for the attribute */ @@ -1101,7 +1047,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, ((H5A_t *)mesg->native)->shared->name = H5MM_xstrdup(udata->new_name); /* Recompute the version to encode the attribute with */ - if(H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0) + if (H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version") /* Mark the message as modified */ @@ -1109,24 +1055,25 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, chk_dirtied = TRUE; /* Release chunk */ - if(H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) + if (H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") chk_proxy = NULL; /* Check for shared message */ - if(mesg->flags & H5O_MSG_FLAG_SHARED) { + if (mesg->flags & H5O_MSG_FLAG_SHARED) { /* Update the shared attribute in the SOHM storage */ - if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, (H5A_t *)mesg->native, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, "unable to update attribute in shared storage") + if (H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, (H5A_t *)mesg->native, NULL) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, + "unable to update attribute in shared storage") } /* end if */ else { /* Sanity check */ HDassert(H5O_msg_is_shared(H5O_ATTR_ID, (H5A_t *)mesg->native) == FALSE); /* Check for attribute message changing size */ - if(HDstrlen(udata->new_name) != HDstrlen(udata->old_name) || - old_version != ((H5A_t *)mesg->native)->shared->version) { - H5A_t *attr; /* Attribute to re-add */ + if (HDstrlen(udata->new_name) != HDstrlen(udata->old_name) || + old_version != ((H5A_t *)mesg->native)->shared->version) { + H5A_t *attr; /* Attribute to re-add */ /* Take ownership of the message's native info (the attribute) * so any shared objects in the file aren't adjusted (and @@ -1138,22 +1085,25 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, * list of messages during the "add the modified attribute" * step, invalidating the message pointer we have here - QAK) */ - attr = (H5A_t *)mesg->native; + attr = (H5A_t *)mesg->native; mesg->native = NULL; /* Delete old attribute */ - /* (doesn't decrement the link count on shared components becuase + /* (doesn't decrement the link count on shared components because * the "native" pointer has been reset) */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release previous attribute") + if (H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, + "unable to release previous attribute") - *oh_modified = H5O_MODIFY_CONDENSE; + *oh_modified = H5O_MODIFY_CONDENSE; /* Append renamed attribute to object header */ /* (Don't let it become shared) */ - if(H5O_msg_append_real(udata->f, udata->dxpl_id, oh, H5O_MSG_ATTR, (mesg->flags | H5O_MSG_FLAG_DONTSHARE), 0, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to relocate renamed attribute in header") + if (H5O_msg_append_real(udata->f, udata->dxpl_id, oh, H5O_MSG_ATTR, + (mesg->flags | H5O_MSG_FLAG_DONTSHARE), 0, attr) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5_ITER_ERROR, + "unable to relocate renamed attribute in header") /* Sanity check */ HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr) == FALSE); @@ -1161,7 +1111,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* Close the local copy of the attribute */ H5A_close(attr); } /* end if */ - } /* end else */ + } /* end else */ /* Indicate that the object header was modified */ *oh_modified |= H5O_MODIFY; @@ -1175,13 +1125,12 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, done: /* Release chunk, if not already done */ - if(chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) + if (chk_proxy && H5O_chunk_unprotect(udata->f, udata->dxpl_id, chk_proxy, chk_dirtied) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_rename_mod_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_rename * @@ -1195,12 +1144,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, - const char *new_name) +H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, const char *new_name) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1210,67 +1158,66 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, HDassert(new_name); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + if (H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for attributes stored densely */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Rename the attribute data in dense storage */ - if(H5A_dense_rename(loc->file, dxpl_id, &ainfo, old_name, new_name) < 0) + if (H5A_dense_rename(loc->file, dxpl_id, &ainfo, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") } /* end if */ else { - H5O_iter_ren_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + H5O_iter_ren_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Set up user data for callback */ - udata.f = loc->file; - udata.dxpl_id = dxpl_id; + udata.f = loc->file; + udata.dxpl_id = dxpl_id; udata.old_name = old_name; udata.new_name = new_name; - udata.found = FALSE; + udata.found = FALSE; /* Iterate over attributes, to check if "new name" exists already */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_rename_chk_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") /* If the new name was found, indicate an error */ - if(udata.found) + if (udata.found) HGOTO_ERROR(H5E_ATTR, H5E_EXISTS, FAIL, "attribute with new name already exists") /* Iterate over attributes again, to actually rename attribute with old name */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_rename_mod_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") /* Check that we found the attribute to rename */ - if(!udata.found) + if (!udata.found) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute with old name") } /* end else */ /* Update the modification time, if any */ - if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) + if (H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_rename */ - /*------------------------------------------------------------------------- * Function: H5O_attr_iterate_real * @@ -1284,14 +1231,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, - H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, - hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) +H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, H5_index_t idx_type, + H5_iter_order_t order, hsize_t skip, hsize_t *last_attr, + const H5A_attr_iter_op_t *attr_op, void *op_data) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ - herr_t ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1302,62 +1249,62 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, HDassert(attr_op); /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + if (H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for attributes stored densely */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Check for skipping too many attributes */ - if(skip > 0 && skip >= ainfo.nattrs) + if (skip > 0 && skip >= ainfo.nattrs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") /* Release the object header */ - if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Iterate over attributes in dense storage */ - if((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, idx_type, order, skip, last_attr, attr_op, op_data)) < 0) + if ((ret_value = H5A_dense_iterate(loc->file, dxpl_id, loc_id, &ainfo, idx_type, order, skip, + last_attr, attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); } /* end if */ else { /* Build table of attributes for compact storage */ - if(H5A_compact_build_table(loc->file, dxpl_id, oh, idx_type, order, &atable) < 0) + if (H5A_compact_build_table(loc->file, dxpl_id, oh, idx_type, order, &atable) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") /* Release the object header */ - if(H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Check for skipping too many attributes */ - if(skip > 0 && skip >= atable.nattrs) + if (skip > 0 && skip >= atable.nattrs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") /* Iterate over attributes in table */ - if((ret_value = H5A_attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0) + if ((ret_value = H5A_attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_CANTNEXT, "iteration operator failed"); } /* end else */ done: /* Release resources */ - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - if(atable.attrs && H5A_attr_release_table(&atable) < 0) + if (atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_iterate_real() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_iterate * @@ -1371,12 +1318,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id, - H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, - hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) +H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, + hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data) { - H5G_loc_t loc; /* Object location */ - herr_t ret_value; /* Return value */ + H5G_loc_t loc; /* Object location */ + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1384,18 +1330,18 @@ H5O_attr_iterate(hid_t loc_id, hid_t dxpl_id, HDassert(attr_op); /* Look up location for location ID */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if (H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Iterate over attributes to locate correct one */ - if((ret_value = H5O_attr_iterate_real(loc_id, loc.oloc, dxpl_id, idx_type, order, skip, last_attr, attr_op, op_data)) < 0) + if ((ret_value = H5O_attr_iterate_real(loc_id, loc.oloc, dxpl_id, idx_type, order, skip, last_attr, + attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_iterate() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_remove_update * @@ -1417,11 +1363,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, - hid_t dxpl_id) +H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, hid_t dxpl_id) { - H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ - herr_t ret_value = SUCCEED; /* Return value */ + H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1434,40 +1379,41 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, ainfo->nattrs--; /* Check for shifting from dense storage back to compact storage */ - if(H5F_addr_defined(ainfo->fheap_addr) && ainfo->nattrs < oh->min_dense) { - hbool_t can_convert = TRUE; /* Whether converting to attribute messages is possible */ - size_t u; /* Local index */ + if (H5F_addr_defined(ainfo->fheap_addr) && ainfo->nattrs < oh->min_dense) { + hbool_t can_convert = TRUE; /* Whether converting to attribute messages is possible */ + size_t u; /* Local index */ /* Build the table of attributes for this object */ - if(H5A_dense_build_table(loc->file, dxpl_id, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0) + if (H5A_dense_build_table(loc->file, dxpl_id, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") /* Inspect attributes in table for ones that can't be converted back * into attribute message form (currently only attributes which * can't fit into an object header message) */ - for(u = 0; u < ainfo->nattrs; u++) - if(H5O_msg_size_oh(loc->file, oh, H5O_ATTR_ID, (atable.attrs[u]), (size_t)0) >= H5O_MESG_MAX_SIZE) { + for (u = 0; u < ainfo->nattrs; u++) + if (H5O_msg_size_oh(loc->file, oh, H5O_ATTR_ID, (atable.attrs[u]), (size_t)0) >= + H5O_MESG_MAX_SIZE) { can_convert = FALSE; break; } /* end if */ /* If ok, insert attributes as object header messages */ - if(can_convert) { - H5A_t *exist_attr = NULL; + if (can_convert) { + H5A_t *exist_attr = NULL; htri_t found_open_attr = FALSE; /* Iterate over attributes, to put them into header */ - for(u = 0; u < ainfo->nattrs; u++) { - htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ + for (u = 0; u < ainfo->nattrs; u++) { + htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */ /* Check if attribute is shared */ - if((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, (atable.attrs[u]))) < 0) + if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, (atable.attrs[u]))) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared") - else if(shared_mesg == 0) { + else if (shared_mesg == 0) { /* Increment reference count on attribute components */ /* (so that they aren't deleted when the dense attribute storage is deleted) */ - if(H5O_attr_link(loc->file, dxpl_id, oh, (atable.attrs[u])) < 0) + if (H5O_attr_link(loc->file, dxpl_id, oh, (atable.attrs[u])) < 0) HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") } /* end if */ else { @@ -1478,48 +1424,49 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, /* Insert attribute message into object header (Will increment reference count on shared attributes) */ /* Find out whether the attribute has been opened */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) + if ((found_open_attr = + H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. If not, still use the message in the attribute table. */ - if(found_open_attr && exist_attr) { - if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, exist_attr) < 0) + if (found_open_attr && exist_attr) { + if (H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, exist_attr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message") - - } else { - if(H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, (atable.attrs[u])) < 0) + } + else { + if (H5O_msg_append_real(loc->file, dxpl_id, oh, H5O_MSG_ATTR, 0, 0, (atable.attrs[u])) < + 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message") } } /* end for */ /* Remove the dense storage */ - if(H5A_dense_delete(loc->file, dxpl_id, ainfo) < 0) + if (H5A_dense_delete(loc->file, dxpl_id, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete dense attribute storage") } /* end if */ - } /* end if */ + } /* end if */ /* Check if we have deleted all the attributes and the attribute info * message should be deleted itself. */ - if(ainfo->nattrs == 0) { - if(H5O_msg_remove_real(loc->file, oh, H5O_MSG_AINFO, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0) + if (ainfo->nattrs == 0) { + if (H5O_msg_remove_real(loc->file, oh, H5O_MSG_AINFO, H5O_ALL, NULL, NULL, TRUE, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute info") } /* end if */ else { - if(H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) + if (H5O_msg_write_real(loc->file, dxpl_id, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") } /* end else */ done: /* Release resources */ - if(atable.attrs && H5A_attr_release_table(&atable) < 0) + if (atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_remove_update() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_remove_cb * @@ -1529,21 +1476,16 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * - * Modifications: - * Vailin Choi; Sept 2011 - * Indicate that the object header is modified and might possibly need - * to condense messages in the object header *------------------------------------------------------------------------- */ static herr_t -H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned H5_ATTR_UNUSED sequence, unsigned *oh_modified, void *_udata/*in,out*/) +H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUSED sequence, + unsigned *oh_modified, void *_udata /*in,out*/) { - H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1553,9 +1495,9 @@ H5O_attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Check for correct attribute message to modify */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { + if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Convert message into a null message (i.e. delete it) */ - if(H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, TRUE) < 0) + if (H5O_release_mesg(udata->f, udata->dxpl_id, oh, mesg, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") /* Indicate that the object header was modified */ @@ -1572,7 +1514,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_remove_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_remove * @@ -1588,10 +1529,10 @@ done: herr_t H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ + H5O_t * oh = NULL; /* Pointer to actual object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - herr_t ret_value = SUCCEED; /* Return value */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1600,61 +1541,60 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HDassert(name); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) + if ((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for attributes stored densely */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Delete attribute from dense storage */ - if(H5A_dense_remove(loc->file, dxpl_id, &ainfo, name) < 0) + if (H5A_dense_remove(loc->file, dxpl_id, &ainfo, name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") } /* end if */ else { - H5O_iter_rm_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + H5O_iter_rm_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Set up user data for callback */ - udata.f = loc->file; + udata.f = loc->file; udata.dxpl_id = dxpl_id; - udata.name = name; - udata.found = FALSE; + udata.name = name; + udata.found = FALSE; /* Iterate over attributes, to locate correct one to delete */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_remove_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") /* Check that we found the attribute */ - if(!udata.found) + if (!udata.found) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute") } /* end else */ /* Update the attribute information after removing an attribute */ - if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 0) + if (ainfo_exists) + if (H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ - if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) + if (H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_remove() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_remove_by_idx * @@ -1669,14 +1609,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, hid_t dxpl_id) +H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ + H5A_attr_table_t atable = {0, NULL}; /* Table of attributes */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1684,71 +1624,70 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, HDassert(loc); /* Pin the object header */ - if(NULL == (oh = H5O_pin(loc, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + if (NULL == (oh = H5O_pin(loc, dxpl_id))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) + if ((ainfo_exists = H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for attributes stored densely */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Delete attribute from dense storage */ - if(H5A_dense_remove_by_idx(loc->file, dxpl_id, &ainfo, idx_type, order, n) < 0) + if (H5A_dense_remove_by_idx(loc->file, dxpl_id, &ainfo, idx_type, order, n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") } /* end if */ else { - H5O_iter_rm_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + H5O_iter_rm_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Build table of attributes for compact storage */ - if(H5A_compact_build_table(loc->file, dxpl_id, oh, idx_type, order, &atable) < 0) + if (H5A_compact_build_table(loc->file, dxpl_id, oh, idx_type, order, &atable) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") /* Check for skipping too many attributes */ - if(n >= atable.nattrs) + if (n >= atable.nattrs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") /* Set up user data for callback, to remove the attribute by name */ - udata.f = loc->file; + udata.f = loc->file; udata.dxpl_id = dxpl_id; - udata.name = ((atable.attrs[n])->shared)->name; - udata.found = FALSE; + udata.name = ((atable.attrs[n])->shared)->name; + udata.found = FALSE; /* Iterate over attributes, to locate correct one to delete */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_remove_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") /* Check that we found the attribute */ - if(!udata.found) + if (!udata.found) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute") } /* end else */ /* Update the attribute information after removing an attribute */ - if(ainfo_exists) - if(H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 0) + if (ainfo_exists) + if (H5O_attr_remove_update(loc, oh, &ainfo, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") /* Update the modification time, if any */ - if(H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) + if (H5O_touch_oh(loc->file, dxpl_id, oh, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") done: - if(oh && H5O_unpin(oh) < 0) + if (oh && H5O_unpin(oh) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") - if(atable.attrs && H5A_attr_release_table(&atable) < 0) + if (atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_remove_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_count_real * @@ -1764,7 +1703,7 @@ done: herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1774,26 +1713,26 @@ H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs) HDassert(nattrs); /* Check for attributes stored densely */ - if(oh->version > H5O_VERSION_1) { - htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - H5O_ainfo_t ainfo; /* Attribute information for object */ + if (oh->version > H5O_VERSION_1) { + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ + H5O_ainfo_t ainfo; /* Attribute information for object */ /* Attempt to get the attribute information from the object header */ - if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) + if ((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") - else if(ainfo_exists > 0) + else if (ainfo_exists > 0) *nattrs = ainfo.nattrs; else *nattrs = 0; } /* end if */ else { - hsize_t attr_count; /* Number of attributes found */ - unsigned u; /* Local index variable */ + hsize_t attr_count; /* Number of attributes found */ + unsigned u; /* Local index variable */ /* Loop over all messages, counting the attributes */ attr_count = 0; - for(u = 0; u < oh->nmesgs; u++) - if(oh->mesg[u].type == H5O_MSG_ATTR) + for (u = 0; u < oh->nmesgs; u++) + if (oh->mesg[u].type == H5O_MSG_ATTR) attr_count++; *nattrs = attr_count; } /* end else */ @@ -1802,7 +1741,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_count_real */ - /*------------------------------------------------------------------------- * Function: H5O_attr_exists_cb * @@ -1812,21 +1750,16 @@ done: * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol - * koziol@hdfgroup.org * Dec 11 2006 * - * Modifications: - * Vailin Choi; September 2011 - * Change "oh_modified" from boolean to unsigned - * (See H5Oprivate.h for possible flags) *------------------------------------------------------------------------- */ static herr_t -H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned H5_ATTR_UNUSED sequence, unsigned H5_ATTR_UNUSED *oh_modified, void *_udata/*in,out*/) +H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUSED sequence, + unsigned H5_ATTR_UNUSED *oh_modified, void *_udata /*in,out*/) { - H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5O_iter_rm_t *udata = (H5O_iter_rm_t *)_udata; /* Operator user data */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1835,7 +1768,7 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Check for correct attribute message */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { + if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { /* Indicate that this message is the attribute sought */ udata->found = TRUE; @@ -1846,7 +1779,6 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_exists_cb() */ - /*------------------------------------------------------------------------- * Function: H5O_attr_exists * @@ -1862,9 +1794,9 @@ H5O_attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg/*in,out*/, htri_t H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + H5O_ainfo_t ainfo; /* Attribute information for object */ + htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1873,37 +1805,37 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) HDassert(name); /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; - if(oh->version > H5O_VERSION_1) { + if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) + if (H5A_get_ainfo(loc->file, dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ /* Check for attributes stored densely */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Check if attribute exists in dense storage */ - if((ret_value = H5A_dense_exists(loc->file, dxpl_id, &ainfo, name)) < 0) + if ((ret_value = H5A_dense_exists(loc->file, dxpl_id, &ainfo, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") } /* end if */ else { - H5O_iter_rm_t udata; /* User data for callback */ - H5O_mesg_operator_t op; /* Wrapper for operator */ + H5O_iter_rm_t udata; /* User data for callback */ + H5O_mesg_operator_t op; /* Wrapper for operator */ /* Set up user data for callback */ - udata.f = loc->file; + udata.f = loc->file; udata.dxpl_id = dxpl_id; - udata.name = name; - udata.found = FALSE; + udata.name = name; + udata.found = FALSE; /* Iterate over existing attributes, checking for attribute with same name */ - op.op_type = H5O_MESG_OP_LIB; + op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O_attr_exists_cb; - if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) + if (H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") /* Check that we found the attribute */ @@ -1911,13 +1843,12 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) } /* end else */ done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_exists */ - /*------------------------------------------------------------------------- * Function: H5O_attr_bh_info * @@ -1933,10 +1864,10 @@ done: herr_t H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) { - H5HF_t *fheap = NULL; /* Fractal heap handle */ - H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ - H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HF_t *fheap = NULL; /* Fractal heap handle */ + H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ + H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1945,63 +1876,64 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) HDassert(bh_info); /* Attributes are only stored in fractal heap & indexed w/v2 B-tree in later versions */ - if(oh->version > H5O_VERSION_1) { - H5O_ainfo_t ainfo; /* Attribute information for object */ - htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ + if (oh->version > H5O_VERSION_1) { + H5O_ainfo_t ainfo; /* Attribute information for object */ + htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) + if ((ainfo_exists = H5A_get_ainfo(f, dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") - else if(ainfo_exists > 0) { + else if (ainfo_exists > 0) { /* Check if name index available */ - if(H5F_addr_defined(ainfo.name_bt2_addr)) { + if (H5F_addr_defined(ainfo.name_bt2_addr)) { /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo.name_bt2_addr, NULL))) + if (NULL == (bt2_name = H5B2_open(f, dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Get name index B-tree size */ - if(H5B2_size(bt2_name, dxpl_id, &(bh_info->index_size)) < 0) + if (H5B2_size(bt2_name, dxpl_id, &(bh_info->index_size)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") } /* end if */ /* Check if creation order index available */ - if(H5F_addr_defined(ainfo.corder_bt2_addr)) { + if (H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo.corder_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + if (NULL == (bt2_corder = H5B2_open(f, dxpl_id, ainfo.corder_bt2_addr, NULL))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, + "unable to open v2 B-tree for creation order index") /* Get creation order index B-tree size */ - if(H5B2_size(bt2_corder, dxpl_id, &(bh_info->index_size)) < 0) + if (H5B2_size(bt2_corder, dxpl_id, &(bh_info->index_size)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") } /* end if */ /* Get storage size of fractal heap, if it's used */ - if(H5F_addr_defined(ainfo.fheap_addr)) { + if (H5F_addr_defined(ainfo.fheap_addr)) { /* Open the fractal heap for attributes */ - if(NULL == (fheap = H5HF_open(f, dxpl_id, ainfo.fheap_addr))) + if (NULL == (fheap = H5HF_open(f, dxpl_id, ainfo.fheap_addr))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") /* Get heap storage size */ - if(H5HF_size(fheap, dxpl_id, &(bh_info->heap_size)) < 0) + if (H5HF_size(fheap, dxpl_id, &(bh_info->heap_size)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") } /* end if */ - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ done: /* Release resources */ - if(fheap && H5HF_close(fheap, dxpl_id) < 0) + if (fheap && H5HF_close(fheap, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") - if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) + if (bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0) + if (bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") FUNC_LEAVE_NOAPI(ret_value) -} /* H5O_attr_bh_info() */ +} /* H5O_attr_bh_info() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: H5O_attr_count * @@ -2017,9 +1949,9 @@ done: int H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) { - H5O_t *oh = NULL; /* Pointer to actual object header */ - hsize_t nattrs; /* Number of attributes */ - int ret_value; /* Return value */ + H5O_t * oh = NULL; /* Pointer to actual object header */ + hsize_t nattrs; /* Number of attributes */ + int ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2027,21 +1959,20 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) HDassert(loc); /* Protect the object header to iterate over */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + if (NULL == (oh = H5O_protect(loc, dxpl_id, H5AC_READ))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve # of attributes on object */ - if(H5O_attr_count_real(loc->file, dxpl_id, oh, &nattrs) < 0) + if (H5O_attr_count_real(loc->file, dxpl_id, oh, &nattrs) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Set return value */ ret_value = (int)nattrs; done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if (oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_count */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - |